package com.whq.mvc.base.designpattern.observe;

public class TikToker1 extends AbstractTikToker {

    public void startSell() {
        System.out.println("startSell...");
        notifyFans("开播了");
    }

    public void endSell() {
        System.out.println("endSell...");
        notifyFans("下播了");
    }


    @Override
    public void addFans(AbstractFans fans) {
        if (!fansList.contains(fans)) {
            fansList.add(fans);
        }
    }

    @Override
    public void removeFans(AbstractFans fans) {
        if (fansList.contains(fans)) {
            fansList.remove(fans);
        }
    }

    @Override
    public void notifyFans(String msg) {
        fansList.forEach(x -> x.accept(msg));
    }
}
